main: override systemd features only when security.nesting=false #619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Distrobuilder creates a systemd generator (
/etc/systemd/system-generators/lxc
) to, among other things, work around problems with broken name space support inside containers.Many of the distro images built by distrobuilder come with systemd. Those often ship multiple systemd units leveraging hardening features that rely on mount name spaces. The problem is that mount name spaces do not work well inside containers so the workaround so far has been to disable those features to avoid causing service failures.
This PR proposes to be more selective and only disable those hardening features relying on mount name spaces when
security.nesting=false
.This was tested on a Focal host with kernel 5.13, LXD 5.0.0-e478009 rev 22894 and the following containers:
I would appreciate some extra testing because a previous attempt (#559) caused many regressions. My hope is those regressions happened because NoNewPrivileges has interactions with mount name spaces which didn't work in the
security.nesting=false
case.